<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> 
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
com.jxtti.model.User userInfo = com.jxtti.utils.AuthUtil.getUserInfo(request);
String orgId=null;
if(userInfo.getDistrictId()==null || userInfo.getDistrictId().equals("0")){ //非超管
	orgId=userInfo.getOrgId().toString();
}
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta http-equiv="X-UA-Compatible" content="IE=9" />
	<meta http-equiv="pragma" content="no-cache" />
	<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> 
	<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%> 
	<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
	<title>头部</title>	
    <script language="javascript" src="<%=basePath %>Scripts/jquery/jquery-1.7.1.min.js" type="text/javascript"></script>	
	<script type="text/javascript" src="<%=basePath %>Scripts/highcharts/highcharts.js"></script>
	 
	<link rel="stylesheet" type="text/css" href="<%=basePath %>Themes/default/css/tableList.css"/> 
  	<link rel="stylesheet" type="text/css" href="<%=basePath %>Themes/default/css/reset-min.css"/> 
	<link rel="stylesheet" type="text/css" href="<%=basePath %>Themes/default/css/global.css"/>
    <link rel="stylesheet" type="text/css" href="<%=basePath %>Themes/default/css/list.css"/>
    <link rel="stylesheet" type="text/css" href="<%=basePath %>Themes/default/bootstrap/css/page.css"/>   
 	
 	<link rel="stylesheet" href="<%=basePath %>Scripts/artDialog/skins/default.css" /> 	
	<script src="<%=basePath %>Scripts/artDialog/artDialog.source.js"></script>
 	<script src="<%=basePath %>Scripts/artDialog/iframeTools.source.js"></script>
 	
 	<script type="text/javascript" src="<%=basePath %>Scripts/common/admin-descktop.js"></script>
	
 
	<style type="text/css">
		.ui-block-a,
		.ui-block-b,
		.ui-block-c
		{
		border: 1px solid  #3CA5C7;
		padding: 3px;
		overflow:hidden;
		float:left;
		width:49%;
		}
	</style>
   	<script type="text/javascript">
   		var chart = null;var options; 
   		var datagridUrl= '<%=basePath %>/ArticleList/chartAuditList.json?type=isAudit';
   		
   		
   		<c:if test="${data.isDept!=null && data.isDept=='false'}">
   			var XJUrl = '../ArticleList/chartAuditList.json?type=isAudit&paim=yes&is_contribute=1';		
   			DeptCharHtml(XJUrl,'xjChar');
        </c:if>

		<c:if test="${data.isDept!=null && data.isDept=='true'}">
        	var DeptUrl = '../ArticleList/chartAuditList.json?type=isAudit&paim=yes&is_contribute=0';
			DeptCharHtml(DeptUrl,'xjChar');
    	</c:if>
   		
		function charAjax(url) {
			if (<%=orgId %>!=null){ //是否管理员		
				//创建图表
				$.ajax({  
					type: "POST",  
			        url: url, 				 
				    type:'post',  
				    cache:false,  
				    dataType:'json',  
				    success:function(map) {   	    
				    	options.series=[]; 
		   			    var nameArray=[];
		   			    var yArray=[];		   	
				    	if(map!=null&&map!=""){				    				    
				    		for(var i=0;i<map.length;i++){	    	    			
				    			nameArray.push(timeStamp2String(map[i].modifyDate,2)); //日期
				    			yArray.push(map[i].remark);
				    		}    	    		
				    		var AQIArr={name :"文章数", data : eval("["+yArray.join(',')+"]")} ;
			   			    options.series.push(AQIArr);		   				
				    	}   	
				    	// 设置X轴			 
					    options.xAxis.categories = nameArray;
				    	options.chart.type='line';
				    	options.title.text='每日发表文章数(最近一个月)';
					 	chart = new Highcharts.Chart(options);
				     },  
				     error : function() {  }  
				});	

			}else{
				//创建图表
				$.ajax({  
					type: "POST",  
			        url: url, 				  
				    type:'post',  
				    cache:false,  
				    dataType:'json',  
				    success:function(map) {   	    
				    	options.series=[]; 
		   			    var nameArray=[];
		   			    var yArray=[];		   	
				    	if(map!=null&&map!=""){				    				    
				    		for(var i=0;i<map.length;i++){	    	    			
				    			nameArray.push(map[i].orgIdName);
				    			yArray.push(map[i].remark);
				    		}    	    		
				    		var AQIArr={name :"文章总数", data : eval("["+yArray.join(',')+"]")} ;
			   			    options.series.push(AQIArr);		   				
				    	}   	
				    	// 设置X轴			 
					    options.xAxis.categories = nameArray;
					    options.subtitle.text = getPreDay(30);
					 	chart = new Highcharts.Chart(options);
				     },  
				     error : function() {  }  
				});	

			}
		}
		
		function editEnter(){ 			
			parent.Util.addTab("../ArticleList/listInterfaceAudit.htm", "投稿列表","26");
        }
		
		function editEnter2(){ 			
			parent.Util.addTab("../advisoryMsgController/list.htm", "咨询投诉","28");
        }
				
   	</script>
</head>
<body>
	<div class="ui-grid-a">
		<!-- 最新投稿 -->
		<c:if test="${data.isDept==null}">
		<div class="ui-block-b" style="height:240px;">
        	<div class="list module desk" id="list1">
				<div class="hd">
					<h2 class="t">最新投稿列表</h2>									
				</div>
				<div class="bd">	
					<div id="toolbar">
						<ul>						    
							<li>
								<a href="javascript:void(0)" onclick="editEnter()">								
									更多>>
								</a>
							</li>							
						</ul>
					</div>	 
		  			<table class="l-table" width="100%" cellspacing="0" cellpadding="0">
					<tbody>
						<tr>
							<th width="8%">序号</th>
							<th width="20%">投稿单位</th>
							<th width="30%">标题</th>
							<th width="20%">提交时间</th>
							<th width="15%">状态</th>
							<th width="10%">操作</th>   
						</tr>
						<c:if test="${data.articleList.size() >0}">
						<c:forEach items="${data.articleList}" var="art" varStatus="st"> 
			                <c:if test="${st.count%2 != '0'}">
			                <tr> 
						    </c:if>
							<c:if test="${st.count%2 == '0'}">
							<tr class="odd">
							</c:if> 
			                    <td align="center">${st.index+1}</td>
			                    <td align="center">${art.orgIdName}</td> 
			                    <td align="left">
				                    <c:choose>  
	         						<c:when test="${fn:length(art.title) >12}">  
	             						<c:out value="${fn:substring(art.title, 0, 12)}..." />  
	         						</c:when>  
	        						<c:otherwise>  
	           							<c:out value="${art.title}" />  
	         						</c:otherwise>  
	     							</c:choose> 
     							</td> 
			                    <td align="center">
			                    	<fmt:formatDate pattern="yyyy-MM-dd HH:mm:ss"  value="${art.modifyDate}"  type="both" />									
			                    </td>			                     			                       
			                    <td align="center">
			                      <c:if test="${art.status=='0' }">草稿</c:if>
			                      <c:if test="${art.status=='1' }">等待审核</c:if>
			                      <c:if test="${art.status=='2' }">审核通过</c:if>
			                      <c:if test="${art.status=='3' }">审核失败</c:if>
			                    </td>   
			                    <td align="center" limit="10">
			                    	<a title="处理" onclick="auditArticle('${art.id}')" href="#">
			                    		<img src="<%=basePath %>/pages/Admin/Images/Icon/edit.gif" alt="Edit">
			                    	</a>			                    	
			                    </td> 
			                </tr>
					     </c:forEach>
		           	</c:if>
					<c:if test="${data.articleList.size() <=0}">
			    		<tr> 
			         		<td colspan="6"  align="center">   
			                 		没有符合条件的记录！
			         		</td>
			    		</tr>
					</c:if>   
      				</tbody>
      				</table>
				</div> 				
  			</div>        	    
        </div>
        </c:if>
        <!-- 最新留言 -->    	
        <div class="ui-block-a"  style="height:240px;">
        	<div class="list module desk" id="list1">
				<div class="hd">
					<h2 class="t">最新咨询投诉列表</h2>									
				</div>
				<div class="bd">	
					<div id="toolbar">
						<ul>						    
							<li>
								<a href="javascript:void(0)" onclick="editEnter2()">更多>></a>
							</li>							
						</ul>
					</div>	 
		  			<table class="l-table" width="100%" cellspacing="0" cellpadding="0">
					<tbody>
						<tr>
							<th width="5%">序号</th>
							<th width="10%">类型</th>
							<th width="30%">主题</th>
							<th width="15%">提交时间</th>
							<th width="15%">状态</th>
							<th width="8%">操作</th>   
						</tr>
						<c:if test="${data.advisorydata.page.list.size() >0}">
						<c:forEach items="${data.advisorydata.page.list}" var="dic" varStatus="st"> 
			                <c:if test="${st.count%2 != '0'}">
			                <tr> 
						    </c:if>
							<c:if test="${st.count%2 == '0'}">
							<tr class="odd">
							</c:if> 
			                    <td align="center">${st.index+1}</td>
			                    <td align="center">
			                    	<c:if test="${dic.typeId=='0' }">咨询留言</c:if>
			                      	<c:if test="${dic.typeId=='1' }">污染投诉</c:if>
			                   </td> 
			                    <td align="left" limit="10">
			                     	${dic.title}
			                    </td> 
			                    <td align="center">${dic.createTime}</td>			                     			                       
			                    <td  align="center">
			                      <c:if test="${dic.states=='0' }">等待回复</c:if>
			                      <c:if test="${dic.states=='1' }">已分配</c:if>
			                    </td>   
			                    <td align="center">
			                    	<a title="处理" onclick="editAdvisory('${dic.id}')" href="#">
			                    		<img src="<%=basePath %>/pages/Admin/Images/Icon/edit.gif" alt="Edit">
			                    	</a>
			                    	&nbsp;
			                    	<!-- <a title="删除" onclick="delAdvisory('${dic.id}')" href="#">
			                    		<img src="<%=basePath %>/pages/Admin/Images/Icon/delete.gif" alt="Delete">
			                    	</a>	 -->		                    	
			                    </td> 
			                </tr>
					     </c:forEach>
		           	</c:if>
					<c:if test="${data.advisorydata.page.list.size() <=0}">
			    		<tr> 
			         		<td colspan="6"  align="center">   
			                 		没有符合条件的记录！
			         		</td>
			    		</tr>
					</c:if>   
      				</tbody>
      				</table>
				</div> 				
  			</div>
        </div>               
        <c:if test="${data.isDept!=null}">
         <div class="ui-block-b">         	
        	<!-- 县级发文排名 -->
        	<div id="xjChar" style="min-width:200px;height:240px"></div>
        </div> 
        </c:if>
        
        <div class="ui-block-b" style="width:100%;">
        	<!-- 文章统计 -->
        	<div id="container" style="min-width:700px;height:256px"></div>
        </div>      
        
	</div>
	
</body>
</html>